<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>编辑角色</title>
        <link href="/widget/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"  type="text/css"/>
        {cssjs}
        <link href="/html/file/res/css/inside_page.css" rel="stylesheet"  type="text/css"/>
        <style>
            li{float:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:.2rem 0;}
            .che_input{float:left;}
        </style>
    </head>

    <body>
        <div class="container-fluid larry-wrapper">
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <section class="panel panel-padding">
                        <form id="form1" class="layui-form layui-form-pane" method="post" data-dotype="a" action="./?t=file_addressee">
                            <table class="layui-table">
                                <colgroup>
                                    <col width="150">
                                    <col width="150">
                                    <col width="200">
                                    <col>
                                </colgroup>
                                <thead>
                                    <tr style="background-color:white;">
                                        <th><div class="check_box che_all" title="全选">
                                    <input type="checkbox" title="全选" lay-filter="checkAll"> 
<!--                                    <label class="check" for="" onclick="$('#_checkall').click()">  
                                        <i class="iconfont" id="#icon-duihao2"></i>
                                    </label><a style="float:left;margin:-17px 0 0 16px">全选</a>-->
                                </div></th>
                                <th style="width:950px;position: relative"><input type="text" placeholder="用户名" id="sname" value="{sname}" name="acceptname" autocomplete="off" class="layui-input" style="width:15%;"><input type="button" lay-submit class="layui-btn" lay-filter="search" id="btn_search" value="查找" style="float:left;margin:-37px 0 0 200px"/>
                                <div class="layui-form-item" style="position: absolute;top:10px;right: 150px;border-left: 1px solid #e6e6e6;z-index: 1000">
                                    <div class="layui-input-block" style="margin-left: 30px">
                                        <input type="radio" name="type" value="0" title="按部门" checked=""><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><span>按部门</span></div>
                                        <input type="radio" name="type" value="1" title="按角色"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><span>按角色</span></div>
                                        <input type="radio" name="type" value="2" title="按自定义组"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><span>按自定义组</span></div>
                                    </div>
                                </div>
                                </th>
                                </tr>
                                
                                <input type="hidden" name="sname" id="sname" />
                                <tr>
                                    <th>部门</th>
                                    <th style="width:950px;">用户列表</th>
                                </tr> 
                                </thead>
                                <tbody>
                                    <!-- START list -->
                                    <tr>
                                        <td>
                                            <div class="check_box che_all" title="同部门全选">
                                                <input type="checkbox" class="dept_check"  lay-filter="dept_check" title="{deptname}"> 
<!--                                                <label class="check" for="" onclick="">  
                                                    <i class="iconfont" id="#icon-duihao2"></i>
                                                </label><a style="float:left;margin:-17px 0 0 16px">{deptname}</a>-->
                                            </div></td>
                                        <td>
                                            <!-- START rp -->
                                <li><div class="check_box che_input">
                                        <input id="{username}" name="check" _name="{truename}" title="{truename}" type="checkbox" class="everyvb">  
<!--                                        <label class="check checkchild" for="{id}">  
                                            <i class="iconfont"></i>
                                        </label><a style="float:left;margin:-17px 0 0 16px">{truename}</a> -->
                                    </div>
                                    <input type="hidden" name="accept_id" id="accept_id" value="{username}"/>
                                </li>
                                <!-- END rp -->
                                </td>
                                </tr>
                                <!-- END list -->
                                </tbody>
                            </table> 
                            <input class="layui-btn layui-btn-danger" style="margin:0 0 0 580px;" onclick="getAllcheck();" value="确认" type="button"/>
                        </form>
                    </section>
                </div>
            </div>
        </div>
        <input type="hidden" value="{type}" class="type">
         {jsmodel}
        <script type="text/javascript">
            layui.use('file_addressee');

        </script>
        <script type="text/javascript">
            var userid = queryStr("userid");
            if (userid != "") {
                var useridarr = userid.split(',');
                for (var i = 0; i < useridarr.length; i++) {
                    $("#" + useridarr[i]).prop("checked", true);
                }
            }
           
            $().ready(function () {
                $("#btn_search").on("click", function () {
                    var nm = $("#sname").val();
                    location.href = "?t=file_addressee&sname=" + nm;
                });
            });

            function getAllcheck() {
                var allid = "";
                var allidtxt = "";
                $(".everyvb").each(function () {
                    if ($(this).prop("checked")) {
                        allid += $(this).attr("id") + ",";
                        allidtxt += $(this).attr("_name") + ",";
                    }
                });
                allid = allid.substring(0, allid.length - 1);
                allidtxt = allidtxt.substring(0, allidtxt.length - 1);
                $('#accept_id').val(allid);
                // var frameid = "layui-layer-iframe" + queryStr("fid");
//                parent.frames[frameid].$("#acceptname").attr("title", allidtxt);
//                parent.frames[frameid].$("#acceptname").val(allidtxt);
//                parent.frames[frameid].$("#accept_id").val(allid);
                $(".div_content", parent.document).attr("title", allidtxt);
                $(".div_content", parent.document).html(allidtxt);
                $("#accept_id", parent.document).val(allid);
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭   
            }
        </script>
    </body>
</html>